package Day011_多线程1.ZuoYe;

/**
 * @author zhangyan
 * @date 2020/4/28 17:12
 */
public class Test6 {
    public static void main(String[] args) {

        MyThread4 mt4 = new MyThread4();
        mt4.start();
        while (true){
            if (MyThread4.i == 1){
                System.out.println("死循环结束");
                break;
            }
        }
    }
}

class MyThread4 extends Thread{
     static int i = 0;
    @Override
    public void run() {
        /*try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }*/
        i = 1;
        System.out.println("i的值:" + i);
    }
}